<?php

require_once ('admin.php');
global $current_user;
$error = array();    
$ok = 1;
    /*
     * Submit
     */
    if (isset($_REQUEST['publish_product'])) {	
	if ($_REQUEST['name'] == "") {
	    $error['name'] = "Name can not be blank";
	    $ok = 0;
	}	
			
	if ($ok == 1) {	    
	    Category::add($current_user->ID, $_REQUEST['name'], DealFlight::FLIGHT);
	    wp_redirect(admin_url() . 'flight-category.php');
	}
    }
    ?>    
    <?php include_once ('./admin-header.php');?>
    <link rel="stylesheet" type="text/css" href="css/tuan.css"/>
    
    <div class="wrap nosubsub">
    <h2>Add New Flight Category <?php
	if (!empty($_REQUEST['s']))
	    printf('<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html(wp_unslash($_REQUEST['s'])));
	?>
    </h2>
        
    <form id="posts-filter" method="post">     
	<hr>
	<div style="width:100%; background:#FDFDFD">
	    <table width="707"  height="77" cellspacing="0" >
		<tr>
		    <th width="138" valign="top"  scope="row" align="left">
			<label for="siteupdates">
			    <p class="labelp"><?php _e('Name') ?> (*)</p>  
			</label>
		    </th>
		    <td width="563"  valign="top">
			<div style="margin-top:10px;">:  			    
			    <input  style="width:80%; height:30px;" name="name" type="text" id="name"   
				    value="<?Php
				    if (isset($_POST['name'])) {
					echo $_POST['name'];
				    }
				    ?>"  class="regular-text"> 
			    <span class="errorclass"><Br/><?php echo $error['name']; ?></span>
			</div>
		    </td>
		</tr>
		<tr>
		    <th valign="top"  scope="row" align="left">&nbsp;</th>
		    <td  valign="top"><div style="margin-top:10px; margin-left:5px;">
			    <input type="submit" name="publish_product" id="publish_product" 
				   class="button button-primary button-large" value="ADD" accesskey="p"></div>
		    </td>
		</tr>
	    </table>
	</div>
    </form>

</div>



<?php
include('./admin-footer.php');
?>

